export default {
  checkWarning (flowLimit, taskLimit) {
    const fState = flowLimit.split('_')[0]
    const tState = taskLimit.split('_')[0]
    const fsTime = flowLimit.split('_')[4]
    const fzTime = flowLimit.split('_')[3]
    const tsTime = taskLimit.split('_')[4]
    const tzTime = taskLimit.split('_')[3]
    if (fState === '-1' || tState === '-1') {
      return 0
    }
    if (fState === '不计时' && tState === '不计时') {
      return 99
    } else {
      if (fzTime && tzTime && fzTime !== 0 && tzTime !== 0) {
        const state = fsTime / fzTime < tsTime / tzTime ? fsTime / fzTime : tsTime / tzTime
        return state
      } else if (tzTime && fzTime && fzTime === 0) {
        return tsTime / tzTime
      } else {
        return fsTime / fzTime
      }
    }
  },
  getWarnState (state) {
    if (state >= 0.7) {
      return '正常'
    } else if (state <= 0.7 && state > 0) {
      return '预警'
    } else if (state === 0) {
      return '超期'
    }
  }
}
